package com.xx.job.controller.system;


import com.xx.job.common.PageResult;
import com.xx.job.common.Result;
import com.xx.job.controller.dto.PageDTO;
import com.xx.job.entity.system.SysLoginLog;
import com.xx.job.entity.system.SysLoginLog;
import com.xx.job.service.system.SysLoginLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;
import com.xx.job.controller.base.BaseController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author liangcy
 * @since 2021-01-14
 */
@RestController
@RequestMapping("/api/v1")
public class SysLoginLogController extends BaseController {

    @Autowired
    private SysLoginLogService sysOperaLogService;

    @RequestMapping("/loginloglist")
    public Result loginloglist(PageDTO pageDTO, SysLoginLog sysLoginLog){
        PageResult pageResult = sysOperaLogService.selectPage(pageDTO, sysLoginLog);
        return Result.success(pageResult);
    }


    @PostMapping("/loginlog")
    public Result addOperlog(@RequestBody SysLoginLog sysOperaLog){
        return Result.success(sysOperaLogService.add(sysOperaLog));
    }

    @DeleteMapping("/loginlog/{id}")
    public Result deleteOperlog(@PathVariable Long id){
        return Result.success(sysOperaLogService.delete(id));
    }

    @PutMapping("/loginlog")
    public Result updateOperlog(@RequestBody SysLoginLog sysOperaLog){
        return Result.success(sysOperaLogService.update(sysOperaLog));
    }

    @GetMapping("/loginlog/{id}")
    public Result selectOperlog(@PathVariable Long id){
        return Result.success(sysOperaLogService.select(id));
    }
}

